package ckw.database;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import core.interfaces.Checkable;

public class OKW extends Checkable implements Serializable {

	private static final long serialVersionUID = 1574432275942045646L;

	private Long id;
	private String name;
	private String identificationField;
	private String address;
	private Set<OKWMember> okwMembers = new HashSet<OKWMember>();
	private Configuration configuration;
	private Set<OKW_Election> okw_elections = new HashSet<OKW_Election>();
	private Set<Voter> voters = new HashSet<Voter>();
	
	
	public OKW() {
	}

	public OKW(String name, String identificationField, String address) {
		super();
		this.name = name;
		this.identificationField = identificationField;
		this.address = address;
	}

	public Long getId() {
		return id;
	}

	@SuppressWarnings("unused")
	private void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIdentificationField() {
		return identificationField;
	}

	public void setIdentificationField(String identificationField) {
		this.identificationField = identificationField;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Set<OKWMember> getOkwMembers() {
		return okwMembers;
	}

	public void setOkwMembers(Set<OKWMember> okwMembers) {
		this.okwMembers = okwMembers;
	}

	public void addToOkwMember(OKWMember okwmember) {
		this.getOkwMembers().add(okwmember);
		okwmember.getOkws().add(this);
	}

	public void removeFromOkwMember(OKWMember okwmember) {
		this.getOkwMembers().remove(okwmember);
		okwmember.getOkws().remove(this);
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	public Set<OKW_Election> getOkw_elections() {
		return okw_elections;
	}

	public void setOkw_elections(Set<OKW_Election> okw_elections) {
		this.okw_elections = okw_elections;
	}

	public Set<Voter> getVoters() {
		return voters;
	}

	public void setVoters(Set<Voter> voters) {
		this.voters = voters;
	}

	public void addToVoter(Voter voter) {
		this.getVoters().add(voter);
		voter.setOkw(this);
	}

	public void removeFromVoter(Voter voter) {
		this.getVoters().remove(voter);
		voter.setOkw(null);
	}
}
